using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Reap.AzureResource.Model.Models.Mapping
{
    public class ResourceActivityMap : EntityTypeConfiguration<ResourceActivity>
    {
        public ResourceActivityMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            // Table & Column Mappings
            this.ToTable("ResourceActivity");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.ResourceId).HasColumnName("ResourceId");
            this.Property(t => t.ActivityDate).HasColumnName("ActivityDate");

            // Relationships
            this.HasRequired(t => t.Resource)
                .WithMany(t => t.ResourceActivities)
                .HasForeignKey(d => d.ResourceId);

        }
    }
}
